<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性</title>
</head>
<body>

<div id="app">
    {{ reverseText }}
</div>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script type="text/javascript">
    var app = new Vue({
        el:"#app",
        data:{
            text:"123,456",
        },
        computed:{
            reverseText:function () {
                //这里的this指向的是当前的Vue实例
                return this.text.split(",").reverse().join(",");
            }
        }
    })
</script>
</body>
</html>